home *** CD-ROM | disk | FTP | other *** search
-
- /*
- File: PaperTypeLibrary.c
-
- Contains: Handy papertype sample routines.
-
- Version: Quickdraw GX 1.1
-
- Written by: Dave Hersey
-
- Copyright: © 1994-1995 by Apple Computer, Inc., all rights reserved.
-
- File Ownership:
-
- DRI: Dave Hersey
-
- Other Contact: Ron Voss
-
- Technology: QuickDraw GX
-
- Change History (most recent first):
-
- <1> 6/6/95 DH First checked in.
- */
-
- #include "PaperTypeLibrary.h"
-
-
- /****************************************************************************************
-
- GetPaperTypeBaseType
-
- function :
- GetPaperTypeBaseType returns the specified paper type's base paper type value.
-
- parameters :
- thePaperType (in) reference to target paper type
- theBasePaperType (out) paper type's base value
-
- returns :
- error code
-
- ****************************************************************************************/
- long GetPaperTypeBaseType(
- gxPaperType thePaperType)
- {
- gxBaseInfo info;
-
- GetCollectionItem(GXGetPaperTypeCollection(thePaperType), gxBaseTag, gxPrintingTagID, nil, &info);
- return info.baseType;
- }
- /* GetPaperTypeBaseType */
-
-
- //<FF>
- /****************************************************************************************
-
- SetPaperTypeBaseType
-
- function :
- SetPaperTypeBaseType saves the specified base paper type in the target paper type.
-
- parameters :
- thePaperType (in) reference to target paper type
- theBasePaperType (in) new base paper type value
-
- returns :
- error code
-
- ****************************************************************************************/
- void SetPaperTypeBaseType(
- gxPaperType thePaperType,
- long theBasePaperType)
- {
- gxBaseInfo info;
-
- info.baseType = theBasePaperType;
- AddCollectionItem(GXGetPaperTypeCollection(thePaperType), gxBaseTag, gxPrintingTagID, sizeof(gxBaseInfo), &info);
- }
- /* SetPaperTypeBaseType */
-
-
- //<FF>
- /****************************************************************************************
-
- GetPaperTypeCreator
-
- function :
- GetPaperTypeCreator returns the specified paper type's creator.
-
- parameters :
- thePaperType (in) reference to target paper type
- theCreator (out) paper type's creator value
-
- returns :
- error code
-
- ****************************************************************************************/
- OSType GetPaperTypeCreator(
- gxPaperType thePaperType)
- {
- gxCreatorInfo info;
-
- GetCollectionItem(GXGetPaperTypeCollection(thePaperType), gxCreatorTag, gxPrintingTagID, nil, &info);
- return info.creator;
- }
- /* GetPaperTypeCreator */
-
-
- //<FF>
- /****************************************************************************************
-
- SetPaperTypeCreator
-
- function :
- SetPaperTypeCreator saves the specified creator in the target paper type.
-
- parameters :
- thePaperType (in) reference to target paper type
- theCreator (in) new paper type creator value
-
- returns :
- error code
-
- ****************************************************************************************/
- void SetPaperTypeCreator(
- gxPaperType thePaperType,
- OSType theCreator)
- {
- gxCreatorInfo info;
-
- info.creator = theCreator;
- AddCollectionItem(GXGetPaperTypeCollection(thePaperType), gxCreatorTag, gxPrintingTagID, sizeof(gxCreatorInfo), &info);
- }
- /* SetPaperTypeCreator */
-
-
- //<FF>
- /****************************************************************************************
-
- GetPaperTypeUnits
-
- function :
- GetPaperTypeUnits returns the specified paper type's units.
-
- parameters :
- thePaperType (in) reference to target paper type
- theUnits (out) paper type's units
-
- returns :
- error code
-
- ****************************************************************************************/
- unsigned char GetPaperTypeUnits(
- gxPaperType thePaperType)
- {
- gxUnitsInfo info;
-
- GetCollectionItem(GXGetPaperTypeCollection(thePaperType), gxUnitsTag, gxPrintingTagID, nil, &info);
- return info.units;
- }
- /* GetPaperTypeUnits */
-
-
- //<FF>
- /****************************************************************************************
-
- SetPaperTypeUnits
-
- function :
- SetPaperTypeUnits saves the specified units in the target paper type.
-
-
- parameters :
- thePaperType (in) reference to target paper type
- theUnits (in) new paper type's units setting
-
- returns :
- error code
-
- ****************************************************************************************/
- void SetPaperTypeUnits(
- gxPaperType thePaperType,
- unsigned char theUnits)
- {
- gxUnitsInfo info;
-
- info.units = theUnits;
- AddCollectionItem(GXGetPaperTypeCollection(thePaperType), gxUnitsTag, gxPrintingTagID, sizeof(gxUnitsInfo), &info);
- }
- /* SetPaperTypeUnits */
-
-
- //<FF>
- /****************************************************************************************
-
- GetPaperTypeFlags
-
- function :
- GetPaperTypeFlags returns the specified paper type's flags.
-
- parameters :
- thePaperType (in) reference to target paper type
- theFlags (out) paper type's flags
-
- returns :
- error code
-
- ****************************************************************************************/
- unsigned long GetPaperTypeFlags(
- gxPaperType thePaperType)
- {
- gxFlagsInfo info;
-
- GetCollectionItem(GXGetPaperTypeCollection(thePaperType), gxFlagsTag, gxPrintingTagID, nil, &info);
- return info.flags & 0x00FFFFFF;
- }
- /* GetPaperTypeFlags */
-
-
- //<FF>
- /****************************************************************************************
-
- SetPaperTypeFlags
-
- function :
- SetPaperTypeFlags saves the specified flags in the target paper type.
-
- parameters :
- thePaperType (in) reference to target paper type
- theFlags (in) new paper type's flags setting
-
- returns :
- error code
-
- ****************************************************************************************/
- void SetPaperTypeFlags(
- gxPaperType thePaperType,
- unsigned long theFlags)
- {
- gxFlagsInfo info;
-
- info.flags = theFlags & 0x00FFFFFF;
- AddCollectionItem(GXGetPaperTypeCollection(thePaperType), gxFlagsTag, gxPrintingTagID, sizeof(gxFlagsInfo), &info);
- }
- /* SetPaperTypeFlags */
-
-
- //<FF>
- /****************************************************************************************
-
- GetPaperTypeComment
-
- function :
- GetPaperTypeComment returns the specified paper type's comment.
-
- parameters :
- thePaperType (in) reference to target paper type
- theComment (out) the comment returned (Pascal string)
-
- returns :
- error code
-
- ****************************************************************************************/
- void GetPaperTypeComment(
- gxPaperType thePaperType,
- Str255 theComment)
- {
- long itemSize = sizeof(Str255);
- OSErr anErr = GetCollectionItem(GXGetPaperTypeCollection(thePaperType), gxCommentTag, gxPrintingTagID,
- &itemSize, theComment);
- if (anErr)
- theComment[0] = '\0';
- }
- /* GetPaperTypeComment */
-
-
- //<FF>
- /****************************************************************************************
-
- SetPaperTypeComment
-
- function :
- SetPaperTypeComment saves the specified comment in the target paper type.
-
- parameters :
- thePaperType (in) reference to target paper type
- theComment (in) the comment to save (Pascal string)
-
- returns :
- error code
-
- ****************************************************************************************/
- OSErr SetPaperTypeComment (
- gxPaperType thePaperType,
- Str255 theComment)
- {
- return AddCollectionItem(GXGetPaperTypeCollection(thePaperType), gxCommentTag, gxPrintingTagID,
- theComment[0] + 1, theComment);
- }
- /* SetPaperTypeComment */
-
-
- //<FF>
- /****************************************************************************************
-
- LockFormatPaperType
-
- function :
- LockFormatPaperType sets the lock state of the paper type associated with the
- target format. To lock the format's paper type, pass true for lockPaperType;
- otherwise pass false. A special collection item is attached to the format's
- collection which contains a single Boolean indicating the current lock state
- (true if locked; false if not).
-
- parameters :
- theJob (in) reference to the target job
- theFormat (in) reference to the target format
- lockPaperType (in) true => lock the paper type; false => unlock it
-
- returns :
- nothing
-
- ****************************************************************************************/
- void LockFormatPaperType(
- gxFormat theFormat,
- Boolean lockPaperType)
- {
- OSErr anErr;
- Collection formatCollection;
-
- formatCollection = GXGetFormatCollection(theFormat);
-
- anErr = AddCollectionItem( formatCollection,
- gxPaperTypeLockTag,
- gxPrintingTagID,
- sizeof(Boolean),
- &lockPaperType);
-
- if (anErr != noErr)
- GXSetJobError(GXGetFormatJob(theFormat), anErr);
- }
- /* LockFormatPaperType */
-
-